package com.zz.concurrent.base;

/**
 * Author: zhangzhen
 * DATE: Created in 2018/8/14 9:53
 * Description:
 */
public class ArmyRunable implements Runnable {

    volatile boolean keepRunning = false;
    @Override
    public void run() {
        while(keepRunning) {
            for(int i=0; i<5; i++) {
                System.out.println(Thread.currentThread().getName() + "进攻对方["+i+"]");
                Thread.yield();
            }
        }
        System.out.println(Thread.currentThread().getName() + "结束了战斗!");
    }
}
